/**
 * Copyright (C) 2018 - 2020 https://github.com/LeeYan9
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.entity;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author Lee
 * Create Class on 2018/8/9
 * @com.bifrost.entity
 * @wechat-mall
 */
@Data
@Entity
@Table(name = "PLAN_CUSOMER",
indexes = {@Index(name = "PLAN_ID_Index" , columnList = "PLAN_ID" , unique = false)}
)
public class PlanCusomer extends BaseEntity implements Serializable {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "PLANCUSOMER_ID",unique = true, nullable = false)
    private Long plancusomerId;
    @Column(name = "STATUS" , columnDefinition = "varchar(20) DEFAULT 'wait' COMMENT 'wait （待开奖），hit （命中）'" , length = 20)
    private String status = "wait";;
    @Column(name = "SHIPPING_STATUS" , columnDefinition = "varchar(20) DEFAULT 'wait' COMMENT '( wait， shipped 配送状态)'" , length = 20)
    private String shippingStatus = "wait";
    @Column(name = "CUSTOME_RNAME" , columnDefinition = "varchar(20) DEFAULT NULL COMMENT '用户名称'" , length = 20)
    private String customerName;
    @Column(name = "CUSTOMER_PHONE" , columnDefinition = "varchar(20) DEFAULT NULL COMMENT '用户名称'" , length = 20)
    private String customerPhone;
    @Column(name = "CUSTOMER_AGE" , columnDefinition = "varchar(3) DEFAULT NULL COMMENT '用户年龄'")
    private String customerAge;
    @Column(name = "CUSTOMER_GENDER" , columnDefinition = "varchar(10) DEFAULT NULL COMMENT '用户性别'")
    private String customerGender;
    @Column(name = "CUSTOMER_REMARK" , columnDefinition = "varchar(20) DEFAULT NULL COMMENT '用户名称'" , length = 20)
    private String customerRemark;
    @Column(name = "CUSTOMER_APPLY" , columnDefinition = "varchar(21840) DEFAULT NULL COMMENT '客户申请资料 json'" , length = 255)
    private String customerApply;
    @Column(name = "CUSTOMER_FEEDBACK" , columnDefinition = "varchar(21840) DEFAULT NULL COMMENT '客户反馈问题 json'" , length = 255)
    private String customerFeedback;
    @Column(name = "APPLY_QUANTITY" , columnDefinition = "int(11) DEFAULT 1 COMMENT '客户申请次数'" , length = 11)
    private Integer applyQuantity;
    @Column(name = "PLAN_ID" , columnDefinition = "bigint(20) not null COMMENT '申领活动Id'")
    private Long planId;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PLANITEM_ID" ,foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private PlanItem planItem;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CUSTOMER_ID" ,foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Customer customer;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PRODUCT_ID", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Product product;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PRODUCT_SKU_ID", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private ProductSku productSku;
}
